package com.song.JavaThread_day02.ch2_6;

public class Writer implements Runnable{
	
	
	private PricesInfo pricesInfo;

	public Writer(PricesInfo pricesInfo) {
		super();
		this.pricesInfo = pricesInfo;
	}

	@Override
	public void run() {
		for(int i=0 ; i<10 ;i++)
		{
			System.out.printf("  writer : Attempt to modify the prices.\n" );
			pricesInfo.setPrices(Math.random()*10,Math.random()*8);;
			System.out.printf(" writer : the prices has been modify \n");
			
			try {
				Thread.sleep(1);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		
	}
	
	
	
}
